import request from '@/service'

export interface IUserList {
  id: number
  name: string
  createTime: string
  updateTime: string
}
export interface IUserInfo {
  id: number
  name: string
  avatar: string
}

export interface loginReq {
  username: string
  password: string
}

export interface loginRes {
  id: string
  token: string
}

export const loginApi = (data: loginReq) => {
  return request<loginReq, loginRes>({
    url: '/mock/login',
    method: 'post',
    data
  })
}

export const getUserList = () => {
  return request<any, IUserList[]>({
    url: '/mock/getUserList',
    method: 'get',
    showLoading: false
  })
}

export const getUserInfo = () => {
  return request<any, IUserInfo>({
    url: '/mock/getUserInfo',
    method: 'get',
    showLoading: false
  })
}
